from math import sqrt

prime = []
prime1 = []


for x in range(1001):
	prime1.append(x)
for x in prime1:
	for y in range(1, len(prime1)):
		if x != y and x != 0 and prime1[y]%x == 0:
			prime1[y] = 0
for x in prime1:
	if x != 0:
		prime.append(x)
	

fjoldi = int(input())
for x in range(fjoldi):
	prufa = int(input())
	print(prime[prufa])
		

# Virkar
